home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
prodpack.zip
/
DB4PPSRC.EXE
/
_CATWHIC.PRG
< prev
next >
Wrap
Text File
|
1993-05-04
|
3KB
|
82 lines
PROCEDURE _CatWhich
PARAMETER pc_file, pl_result, pl_esc
*---------------------------------------------------------------------
* NAME
* _CatWhich - determine whether to use the assigned DBF or current view
*
* DESCRIPTION
* The _CatWhich procedure displays a prompt box for the user to
* select either the Current view or the DBF assigned to the object
* file. If the user selects the Current view, the _CatWhich procedure
* will set the <pl_result> parameter to .F. If the user selects the
* assigned catalog file, <pl_result> will be .T.
*
* The prompt box will allow the user to press the first letter
* of the <pc_file> name to select it.
*
* SYNOPSYS
* DO _CatWhich WITH <pc_file>, <pl_result>, <pl_esc>
*
* PARAMETERS
* pc_file = the file name to display for the prompt box
* pl_result = the return value, .t. to use <pc_file>,
* .f. to use Current view
* pl_esc = if Esc pressed, return a .T., else .F.
*
* DEPENDENCIES
* None
*---------------------------------------------------------------------
PRIVATE lc_curkey, lc_curview, lc_pad, lc_1stkey
pl_result = .F.
pl_esc = .F.
lc_curview = [Current view]
DEFINE WINDOW DBForCAT FROM 8,10 TO 16,69 DOUBLE
ACTIVATE WINDOW DBForCAT
DEFINE MENU DBForCAT MESSAGE [Select option and press ENTER, or press ] + ;
[first letter of desired option]
DEFINE PAD CurView OF DBForCAT PROMPT lc_curview AT 1,12
DEFINE PAD File OF DBForCAT PROMPT ( pc_file ) AT 1,35
SHOW MENU DBForCAT
ON SELECTION PAD File OF DBForCAT DEACTIVATE MENU
ON SELECTION PAD CurView OF DBForCAT DEACTIVATE MENU
@ 3,2 SAY [You may choose to use either the current database file]
@ 4,2 SAY [or view, or the database file or view usually]
@ 5,2 SAY [associated with the file you just selected.]
*-- Set up ON KEY LABELs for handling the first letter selection
*-- or the menu pad. When the user presses the first letter of the pad,
*-- issue the {Alt-<letter} to go to the pad, followed by an {Enter}
*-- to select the pad.
lc_curkey = LEFT( lc_curview, 1 )
lc_1stkey = LEFT( pc_file, 1 )
ON KEY LABEL &lc_1stkey KEYBOARD "{Alt-" + lc_1stkey + "}{13}"
ON KEY LABEL &lc_curkey KEYBOARD "{Alt-" + lc_curkey + "}{13}"
ACTIVATE MENU DBForCAT
ON KEY LABEL &lc_1stkey && Clear the ON KEYs
ON KEY LABEL &lc_curkey
IF LASTKEY() = 27 && If the user escaped
pl_esc = .T. && Set escape flag to true
ELSE
lc_pad = PAD() && Get the pad FILE/CURVIEW
IF lc_pad = "FILE" && If file pad
pl_result = .T. && Set the use catalog file flag
ENDIF
ENDIF
RELEASE MENU DBForCAT
RELEASE WINDOW DBForCAT
RETURN
*-- EOP: _CatWhich WITH pc_file, pl_result